package com.negative.activities;

import java.text.SimpleDateFormat;

import com.negative.data.PurchaseData;
import com.negative.logic.BarcodeGenerator;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

public class ETicketActivity extends Activity {

	TextView eventName, eventDate;
	ImageView barcode;
	PurchaseData data;
	SimpleDateFormat df;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// Remove title bar
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);

		// Remove notification bar
		this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.eticket_layout);

		data = (PurchaseData) this.getIntent().getSerializableExtra(
				"PurchaseData");
		eventName = (TextView) findViewById(R.id.eticket_event_name);
		eventDate = (TextView) findViewById(R.id.eticket_event_date);
		barcode = (ImageView) findViewById(R.id.eticket_barcode);

		eventName.setText(data.getEventName());
		eventDate.setText(data.getEventStartDate());
		barcode.setImageBitmap(BarcodeGenerator.createQRBarcode(""
				+ data.getCostumerId() + " " + data.getPurchaseNumber()));
	}

}
